package ru.jexp.servlet;

import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class RequestResponse {
	private static final String APPLICATION_XML_STREAM = "application/xml-stream";

	private HttpServletResponse httpServletResponse;
	private HttpServletRequest httpServletRequest;

	public RequestResponse(HttpServletRequest httpServletRequest,
			HttpServletResponse httpServletResponse) {
		super();
		this.httpServletRequest = httpServletRequest;
		this.httpServletResponse = httpServletResponse;
	}

	public Object read() throws Throwable {
		ObjectInputStream ois = new ObjectInputStream(httpServletRequest
				.getInputStream());
		return ois.readObject();
	}

	public void write(Object object) throws Throwable {
		ObjectOutputStream oos = new ObjectOutputStream(httpServletResponse
				.getOutputStream());
		oos.writeObject(object);
	}

}
